<#setting number_format="#">
/*
 * Copyright ${.now?string("yyyy")} the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ${app.packageName}.dto;

<#if apidocs>import net.ymate.apidocs.annotation.*;</#if>
import net.ymate.platform.core.persistence.Page;
import net.ymate.platform.validation.annotation.VField;
import net.ymate.platform.validation.validate.VNumeric;
import net.ymate.platform.webmvc.annotation.RequestParam;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;

/**
 * PageDTO generated By CrudMojo on ${.now?string("yyyy/MM/dd a HH:mm")}
 *
 * @author ${app.author!"YMP (https://www.ymate.net/)"}
 * @version ${app.version!"1.0.0"}
 */
public final class PageDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    <#if apidocs>@ApiParam(description = "${languageMap.page}<br/>${languageMap.page_description}")
    </#if>@VNumeric(min = 1)
    @VField(name = "${languageMap.page}")
    @RequestParam(defaultValue = "1")
    private Integer page;

    <#if apidocs>@ApiParam(description = "${languageMap.pageSize}<br/>${languageMap.pageSize_description}")
    </#if>@VNumeric(min = 20, max = 200)
    @VField(name = "${languageMap.pageSize}")
    @RequestParam(defaultValue = "20")
    private Integer pageSize;

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Page toPage() {
        return Page.createIfNeed(page, pageSize);
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this)
                .append("page", page)
                .append("pageSize", pageSize)
                .toString();
    }
}